/*
 * Copyright (C) 2013 Fabiano Tarlao
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.easybenchmark.client.benchmarks;

import org.easybenchmark.client.testengines.Sieve;

/**
 *
 * @author Fabiano Tarlao
 */
public class SieveBenchmark extends Benchmark{
    private Sieve sieveCore = new Sieve(DEFAULT_WARMUP_NUMBERIC_RANGE);  
    static private int DEFAULT_WARMUP_NUMBERIC_RANGE = 100;
    private int currentNumericRange;
    
    public SieveBenchmark() {
        //set the benchmark size as the warmup size
        this(DEFAULT_WARMUP_NUMBERIC_RANGE);
    }
 
    public SieveBenchmark(int numbericRangeForPrimesSearch) {
        this.currentNumericRange= numbericRangeForPrimesSearch;
        setBenchmarkDescrition("Computes prime numbers from the current numeric range");
    }
 
  
    @Override
    protected int initBenchTask() {
        sieveCore.setSIZE(currentNumericRange);
        return(0);
    }

    @Override
    protected long benchTask() {
        return(sieveCore.runModifiedSieve());
    }

    @Override
    protected int initWarmUpTask() {
        sieveCore.setSIZE(DEFAULT_WARMUP_NUMBERIC_RANGE);
        return(0);
    }
    
}
